import request  from  '@/utils/request.js'

// 获取spu数据接口
export const reqSpuList = (page, limit, category3Id)=>{
    return request({url: `/admin/product/${page}/${limit}`, method: 'get', params: {category3Id}})
}

// 获取spu信息
export const reqSpu = (spuId)=>{
    return request({url: `/admin/product/getSpuById/${spuId}`, method: 'get'})
}

// 品牌数据：GET 
export const reqTradeMarkList = ()=>{
    return request({url: "/admin/product/baseTrademark/getTrademarkList", method: 'get'})
}
// 获取spu图片 
export const reqSpuImageList = (spuId)=>{
    return request({url: `/admin/product/spuImageList/${spuId}`, method: 'get'})
}

// 平台中全部的销售属性列表  --- 整个平台的属性一共三个
export const reqBaseSaleAttr = ()=>{
    return request({url: "/admin/product/baseSaleAttrList", method: 'get'})
}

// 修改/添加spu
export const reqAddOrUpdateSpu = (spuInfo)=>{
    if(spuInfo.id) {
        return request({url: "/admin/product/updateSpuInfo", method: 'post', data: spuInfo})
    } else {
        return request({url: "/admin/product/saveSpuInfo", method: 'post', data: spuInfo})
    }
    
}

// 删除spu
export const reqDeleteSpu = (spuId)=>{
    return request({url: `/admin/product/deleteSpu/${spuId}`, method: 'delete'})
}

